work.dir= "E:/Jay/"; setwd(work.dir)

load('Check.rData')

height=as.numeric(max(Check$x))

Receiver=c(1:17)
count=NULL
to.plot=as.data.frame(cbind(Receiver, count))

png('turtle.png', width=28, height=19, units='cm', res=300, pointsize=5, bg='white')
par(mfrow=c(4,5),mar=c(5,5,5,5))
for (ii in unique(Check$Transmitter)){

count=Check$x[which(Check$Transmitter==ii)]
Receiver=as.numeric(Check$Receiver[which(Check$Transmitter==ii)])
to.join=as.data.frame(cbind(Receiver,count),row.names=NULL)

bar.heights=merge(to.plot,to.join, all=TRUE)

barplot(bar.heights$count, names.arg=c(1:17), ylim=c(0,max(Check$x[which(Check$Transmitter==ii)])), xlim=c(1,17), main=paste('Turtle ID: ',ii, sep=''))
axis(2,at=seq(1,17,1),labels=c(1:17))
}

dev.off()
